package com.cdl.utils.bean;

import com.cdl.utils.PropertyUtil;
import org.apache.commons.lang.StringUtils;

import java.util.Properties;

/**
 * @author chendongliang 2021/7/18 10:32
 * @description
 */
public class ConfigProperties {

    private static Properties properties = PropertyUtil.InitProp();
    public static String jdbcType ;
    public static String url ;
    public static String userName ;
    public static String password ;

    static{
        try {
            jdbcType = properties.getProperty("jdbc.type");
            if(StringUtils.isBlank(jdbcType)){
                throw new Exception("config.properties配置文件中未设置数据库参数“jdbc.type”");
            }
            url = properties.getProperty(jdbcType+".jdbc.url");
            userName = properties.getProperty(jdbcType+".jdbc.userName");
            password = properties.getProperty(jdbcType+".jdbc.password");
            System.out.println(url+"----"+userName+"--------"+password);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
